/******************************************************************************
** @file	WHResult.h
** @author  Joel Chuca Condo
**
** @date	Agu 9, 2010
**
** @desc	This class represents the result of a operation. 
**			
**
******************************************************************************/

#include "WHResult.h"
#include <sstream>

WHResult::WHResult()
{
}

WHResult::WHResult(const wstring& name, const wstring& description, HRESULT value)
{
    _name = name;
    _description = description;
    _hr = value;
}

WHResult::WHResult(const wstring& description, HRESULT value)
{
    _name = L"";
    _description = description;
    _hr = value;
}

WHResult::WHResult(const WHResult& whr)
{
    _name = whr._name;
    _description = whr._description;
    _hr = whr._hr;
}


string WHResult::toString()
{
    ostringstream oss;
    oss << _description.c_str() << ". Error code = 0x" << hex << _hr << endl;

    return oss.str();
}

wstring WHResult::toWString()
{
    string str = toString();
    wstring temp(str.length(),L' ');
    copy(str.begin(), str.end(), temp.begin());
    return temp; 
}